home *** CD-ROM | disk | FTP | other *** search
- -- card: 2671 from stack: in
- -- bmap block id: 3071
- -- flags: 0000
- -- background id: 3650
- -- name:
- ----- HyperTalk script -----
- on closeCard
- put empty into card field 1
- put empty into card field 2
- end closeCard
-
-
-
- -- part 1 (button)
- -- low flags: 00
- -- high flags: A003
- -- rect: left=205 top=155 right=177 bottom=305
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Answer
- ----- HyperTalk script -----
- ----------------------------------------------------------------------
-
- on mouseUp
- --get an answer from the Data Card and put it into the card field
- --
- put item 2 of line random(15) of card field "Answers" of card id 3931 into card field 1
- end mouseUp
-
- ----------------------------------------------------------------------
-
- --fancier version of above - this one keeps track of the last answer
- --and makes sure the same one does not come up twice in a row.
- --**NOTE: to try out any of these alternate mouseUp routines, you
- -- need to remove the number (for example "2" in this case) and
- -- make sure you only have *one* mouseUp handler in this button.
-
- on mouseUp2
- Global whichOne
- Global lastOne
- put random(15) into whichOne
- if lastOne is whichOne
- then
- repeat until lastOne is not whichOne
- put random(15) into whichOne
- end repeat
- end if
- put item 2 of line whichOne of card field "Answers" of card id 3931 into card field 1
- put whichOne into lastOne
- end mouseUp2
-
- ----------------------------------------------------------------------
-
- --an even fancier version, in case you need to choose multiple
- --lines and want to make sure you don't choose the same line twice
- --for the same card:
-
- on mouseUp3
- put random(15) into randomOne
- put random(15) into randomTwo
- if randomTwo is randomOne
- then
- repeat until randomTwo is not randomOne
- put random(15) into randomTwo
- end repeat
- end if
- put item 2 of line randomOne of card field "Answers" of card id 3931 into card field 1
- put item 2 of line randomTwo of card field "Answers" of card id 3931 into card field 2
- end mouseUp3
-
- ----------------------------------------------------------------------
-
- --and a *really* fancy version, for two lines, neither of which
- --are repeated from the previous card:
-
- on mouseUp4
- Global randomOne
- Global randomTwo
- Global oldOne
- Global oldTwo
- --
- put random(15) into randomOne
- if randomOne is oldOne or randomOne is oldTwo
- then
- repeat until randomOne is not oldOne and randomOne is not oldTwo
- put random(15) into randomOne
- end repeat
- end if
- --
- put random(15) into randomTwo
- if randomTwo is oldTwo or randomTwo is oldOne
- then
- repeat until randomTwo is not oldTwo and randomTwo is not oldOne
- put random(15) into randomTwo
- end repeat
- end if
- --
- if randomTwo is randomOne
- then
- repeat until randomTwo is not randomOne and randomTwo is not oldTwo and randomTwo is not oldOne
- put random(15) into randomTwo
- end repeat
- end if
- put item 2 of line randomOne of card field "Answers" of card id 3931 into card field 1
- put item 2 of line randomTwo of card field "Answers" of card id 3931 into card field 2
- put randomOne into oldOne
- put randomTwo into oldTwo
- end mouseUp4
-
- ----------------------------------------------------------------------
-
- --finally (although interesting permutations don't stop!),
- --here's a script for creating a random set, with no numbers
- --repeated. This version makes a set of 10 numbers picked from
- --1 to 20.
-
- on mouseUp5
- put random(20) into randomSet
- put random(20) into randomTemp
- repeat while the number of items in randomSet < 10
- if randomTemp is not in randomSet
- then put randomTemp & "," & randomSet into randomSet
- else put random(20) into randomTemp
- end repeat
- --
- --if you'd like the resulting set put in ascending order,
- --remove the two dashes from the following line:
- sort items of randomSet ascending numeric
- --
- put randomSet
- end mouseUp5
-
- ------------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -- part 2 (field)
- -- low flags: 04
- -- high flags: 0000
- -- rect: left=177 top=206 right=224 bottom=462
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Answer
-
-
- -- part 3 (button)
- -- low flags: 00
- -- high flags: A003
- -- rect: left=180 top=260 right=284 bottom=338
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Back to Explanation
- ----- HyperTalk script -----
- on mouseUp
- go to card id 4857
- end mouseUp
-
-
- -- part 6 (field)
- -- low flags: 04
- -- high flags: 0000
- -- rect: left=177 top=227 right=245 bottom=462
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name:
-